#include <iostream>
#include <algorithm>
using namespace std;

int p1, p2, p3,n;
string s;
string ret;

bool isdig(char ch)
{
    return ch <= '9' && ch >= '0';
}

bool islet(char ch)
{
    return ch >= 'a' && ch <= 'z';
}

void add(char l, char r)
{
    string t;
    for (char ch = l + 1; ch < r; ch++)
    {
        char tmp = ch;
        if (p1 == 2 && islet(tmp))
            tmp -= 32;
        else if (p1 == 3)
            tmp = '*';

        for (int i = 0; i < p2; i++)
        {
            t += tmp;
        }
    }
    if (p3 == 2)
        reverse(t.begin(), t.end());
    ret += t;
}

int main()
{
    cin >> p1 >> p2 >> p3 >> s;
     n = s.size();
    for (int i = 0; i < n; i++)
    {
        char ch = s[i];
        if (ch != '-' || i == 0 || i == n - 1)
            ret += ch;
        else
        {
            char left = s[i - 1], right = s[i + 1];
            if (isdig(left) && isdig(right) && left < right ||
                islet(left) && islet(right) && left < right)
                add(left, right);
            else
                ret += ch;
        }
    }

    cout << ret << endl;

    return 0;
}